Tutorial: system.monitorExternalProcess

system.monitorExternalProcess

Monitors a running process.

Example

fin.desktop.System.monitorExternalProcess({
    pid: 2508,
    listener: function(result) {
        console.log('the exit code', result.exitCode);
    }
}, function (payload) {
    console.log("The process is now being monitored: ", payload.uuid);
}, function (error) {
    console.log("Error:", error);
});

Example specifying a lifetime for an external process

By specifying a lifetime, an external process can live as long the window/application that launched it or persist after the application exits. The default value is null, which is equivalent to 'persist', meaning the process lives on after the application exits.

fin.desktop.System.monitorExternalProcess({
    pid: 2508,
    listener: function (result) {
        console.log('the exit code', result.exitCode);
    },
    lifetime: 'window' // Values can be 'application', 'window', 'persist', or null
}, function (payload) {
    console.log('Success:', payload.uuid);
}, function (error) {
    console.log('Error:', error);
});

Note: A process that exits when the window/application exits cannot be released via fin.desktop.System.releaseExternalProcess.