Tutorial: system.terminateExternalProcess


Attempt to close an external process. The process will be terminated if it has not closed after the elapsed timeout in milliseconds.


// notepad is in the system’s PATH
    path: "notepad",
    arguments: "",
    listener: function (result) {
        console.log("The exit code", result.exitCode);
}, function (result) {
    console.log("Result UUID is " + result.uuid);

    // Attempt to close the process. Terminate after 4 seconds if it
    // has not done so.
    fin.desktop.System.terminateExternalProcess(result.uuid, 4000, true, function (info) {
        console.log("Termination result " + info.result);
    }, function (reason) {
        console.log("failure: " + reason);

Success callback

//This response has the following shape:
    result: "clean" //Describes how the process termination was handled.
                    //"clean" - The process was closed.
                    //"terminated" - The process was terminated.
                    //"failed" - The close/terminate operation was unable to complete.