Skip to content

Commit

Permalink
Merge branch 'master' of github.com:remy/nodemon
Browse files Browse the repository at this point in the history
* 'master' of github.com:remy/nodemon:
  chore: adding funding file
  chore: update stalebot
  feat: add message event
  fix: disable fork only if string starts with dash
  feat: add TypeScript to default execPath (#1552)
  fix: Quote zero-length strings in arguments (#1551)
  • Loading branch information
remy committed May 25, 2019
2 parents 95fa05a + d84f421 commit 5124ae9
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .github/FUNDING.yml
@@ -0,0 +1,2 @@
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
open_collective: nodemon
1 change: 1 addition & 0 deletions .github/stale.yml
Expand Up @@ -6,6 +6,7 @@ daysUntilClose: 7
exemptLabels:
- pinned
- security
- not-stale
# Label to use when marking an issue as stale
staleLabel: stale
# Comment to post when marking an issue as stale. Set to `false` to disable
Expand Down
1 change: 1 addition & 0 deletions lib/config/defaults.js
Expand Up @@ -7,6 +7,7 @@ module.exports = {
execMap: {
py: 'python',
rb: 'ruby',
ts: 'ts-node',
// more can be added here such as ls: lsc - but please ensure it's cross
// compatible with linux, mac and windows, or make the default.js
// dynamically append the `.cmd` for node based utilities
Expand Down
8 changes: 7 additions & 1 deletion lib/monitor/run.js
Expand Up @@ -91,7 +91,7 @@ function run(options) {
const shouldFork =
!config.options.spawn &&
!inBinPath &&
firstArg.indexOf('-') === -1 && // don't fork if there's a node exec arg
!(firstArg.indexOf('-') === 0) && // don't fork if there's a node exec arg
firstArg !== 'inspect' && // don't fork it's `inspect` debugger
executable === 'node' && // only fork if node
utils.version.major > 4 // only fork if node version > 4
Expand Down Expand Up @@ -133,6 +133,12 @@ function run(options) {
bus.stdout = child.stdout;
bus.stderr = child.stderr;
}

if (shouldFork) {
child.on('message', function (message, sendHandle) {
bus.emit('message', message, sendHandle);
});
}
}

bus.emit('start');
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/index.js
Expand Up @@ -69,7 +69,7 @@ var utils = (module.exports = {
args.map(function (arg) {
// if an argument contains a space, we want to show it with quotes
// around it to indicate that it is a single argument
if (arg.indexOf(' ') === -1) {
if (arg.length > 0 && arg.indexOf(' ') === -1) {
return arg;
}
// this should correctly escape nested quotes
Expand Down

0 comments on commit 5124ae9

Please sign in to comment.