From fa7496364c9639ff779eb4d7bd623c2d8e5a799a Mon Sep 17 00:00:00 2001 From: nightwing Date: Wed, 8 Jul 2015 16:12:17 +0400 Subject: [PATCH] fix debugger not working on on FreeBSD --- node_modules/vfs-local/localfs.js | 45 ++++++++++++++++--------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/node_modules/vfs-local/localfs.js b/node_modules/vfs-local/localfs.js index 43d98381..82bd9411 100644 --- a/node_modules/vfs-local/localfs.js +++ b/node_modules/vfs-local/localfs.js @@ -1610,29 +1610,30 @@ module.exports = function setup(fsOptions) { function fetchPid(callback, retries){ if (!retries) retries = 0; - - _execFile("ps", ["ax"], { maxBuffer: 1000 * 1024 }, - function(err, stdout){ - var matches = (stdout || "").split("\n").filter(function(line) { - return line.indexOf(watchFile) > -1 - && !/\-L cloud9[\d\.]+ new/.test(line) - && line.indexOf("2> /dev/null") === -1; - }); - - // logToFile(options.session + ":" + JSON.stringify(matches)); - - if (!matches.length && retries < 10) { - // logToFile(options.session + ": RETRY MATCH"); - setTimeout(fetchPid.bind(null, callback, ++retries), 30); - return; - } - - callback(err, { - pid: matches && matches.length - ? parseInt(matches[0].trim(), 10) - : -1 - }); + // can we use ps axwww instead of COLUMNS? + _execFile("ps", ["ax", "-opid,command"], { + maxBuffer: 1000 * 1024, env: {COLUMNS: 500} + }, function(err, stdout){ + var matches = (stdout || "").split("\n").filter(function(line) { + return line.indexOf(watchFile) > -1 + && !/\-L cloud9[\d\.]+ new/.test(line) + && line.indexOf("2> /dev/null") === -1; }); + + // logToFile(options.session + ":" + JSON.stringify(matches)); + + if (!matches.length && retries < 10) { + // logToFile(options.session + ": RETRY MATCH"); + setTimeout(fetchPid.bind(null, callback, ++retries), 30); + return; + } + + callback(err, { + pid: matches && matches.length + ? parseInt(matches[0].trim(), 10) + : -1 + }); + }); } // Fetch PID of a running process and return it