function probeKill(){

    // Convert callback base system command to promise base
    var deferred = Q.defer();

    // Check if there is a process running
    if(ping == null){
        var err = new Error(
            util.format(
                'Ping process not running!!'
            )
        );
        deferred.reject(err);
    }else{
        // Try to kill ping process
        try{
            ping.kill();
            var res = 'Ping process killed!';
            // ping.disconnect();
            // var res = 'Ping process killed!';
            deferred.resolve(res);
        }catch(err){
            deferred.reject(err);
            return deferred.promise;
        }
    }
    return deferred.promise;
}
/**
 * Kills ping.process.probe in the middle.
 *
 * @description Only the last ping process called by ping.process.probe will be killed.
 * @return {Promise}
 */
Kills ping.process.probe in the middle.
@description Only the last ping process called by ping.process.probe will be killed.
@return {Promise}
Kills ping . process . probe in the middle . @description Only the last ping process called by ping . process . probe will be killed . @return { Promise }
function probeKill(){
    var deferred = Q.defer();
    if(ping == null){
        var err = new Error(
            util.format(
                'Ping process not running!!'
            )
        );
        deferred.reject(err);
    }else{
        try{
            ping.kill();
            var res = 'Ping process killed!';
            deferred.resolve(res);
        }catch(err){
            deferred.reject(err);
            return deferred.promise;
        }
    }
    return deferred.promise;
}
function probeKill ( ) { var deferred = Q . defer ( ) ; if ( ping == null ) { var err = new Error ( util . format ( 'Ping process not running!!' ) ) ; deferred . reject ( err ) ; } else { try { ping . kill ( ) ; var res = 'Ping process killed!' ; deferred . resolve ( res ) ; } catch ( err ) { deferred . reject ( err ) ; return deferred . promise ; } } return deferred . promise ; }
Kills ping.process.probe in the middle.
Kills ping . process . probe in the middle .
// Convert callback base system command to promise base // Check if there is a process running // Try to kill ping process // ping.disconnect(); // var res = 'Ping process killed!';