Skip to content

Commit 0f39b2e

Browse files
authored
fix: make it possible for windows to checkout (#1270)
Fixes #1255
1 parent 94b526f commit 0f39b2e

File tree

7 files changed

+114
-105
lines changed

7 files changed

+114
-105
lines changed

test/fixtures/some 'file

Lines changed: 0 additions & 3 deletions
This file was deleted.

test/fixtures/some \file

Lines changed: 0 additions & 3 deletions
This file was deleted.

test/fixtures/some file

Lines changed: 0 additions & 2 deletions
This file was deleted.

test/fixtures/some"file

Lines changed: 0 additions & 2 deletions
This file was deleted.

test/fixtures/some\"file

Lines changed: 0 additions & 3 deletions
This file was deleted.

test/fork/run-mac-only.test.js

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
const fs = require('fs');
2+
const assert = require('assert');
3+
const utils = require('../utils');
4+
const appJS = utils.appjs;
5+
const run = utils.run;
6+
7+
const filenames = [
8+
[__dirname + 'some\\\"file', '#!/usr/bin/env node\nconsole.log("OK");'],
9+
[__dirname + 'some\ \\file', '#!/bin/sh\necho "OK"'],
10+
];
11+
12+
if (!process.env.TRAVIS && process.platform !== 'win32') {
13+
describe('nodemon fork (mac only)', () => {
14+
before(() => {
15+
filenames.map(file => fs.writeFileSync(file[0], file[1], 'utf8'));
16+
});
17+
18+
after(() => {
19+
filenames.map(file => fs.unlinkSync(file[0]));
20+
});
21+
22+
it('should start a fork exec with quotes and escaping', done => {
23+
var found = false;
24+
var p = run({
25+
exec: 'bin/nodemon.js',
26+
// make nodemon verbose so we can check the filters being applied
27+
args: ['-q', '--exec', filenames[0][0]]
28+
}, {
29+
error: function (data) {
30+
p.send('quit');
31+
done(new Error(data));
32+
},
33+
output: function (data) {
34+
// process.stdout.write(data);
35+
if (data.trim() === 'OK') {
36+
found = true;
37+
}
38+
}
39+
});
40+
41+
p.on('message', function (event) {
42+
if (event.type === 'start') {
43+
setTimeout(function () {
44+
p.send('quit');
45+
done();
46+
assert(found, '"OK" message was found');
47+
}, 500);
48+
}
49+
});
50+
});
51+
52+
it('should start a fork exec with spaces and slashes', done => {
53+
var found = false;
54+
var p = run({
55+
exec: 'bin/nodemon.js',
56+
// make nodemon verbose so we can check the filters being applied
57+
args: ['-q', '--exec', `"${filenames[1][0]}`]
58+
}, {
59+
error: function (data) {
60+
p.send('quit');
61+
done(new Error(data));
62+
},
63+
output: function (data) {
64+
// process.stdout.write(data);
65+
if (data.trim() === 'OK') {
66+
found = true;
67+
}
68+
}
69+
});
70+
71+
p.on('message', function (event) {
72+
if (event.type === 'start') {
73+
setTimeout(function () {
74+
p.send('quit');
75+
done();
76+
assert(found, '"OK" message was found');
77+
}, 500);
78+
}
79+
});
80+
});
81+
});
82+
}

test/fork/run.test.js

Lines changed: 32 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*global describe:true, it: true */
22
var assert = require('assert'),
3-
utils = require('../utils'),
4-
appjs = utils.appjs,
5-
run = utils.run;
3+
utils = require('../utils'),
4+
appjs = utils.appjs,
5+
run = utils.run;
66

77
describe('nodemon fork', function () {
88
it('should start a fork', function (done) {
@@ -30,77 +30,17 @@ describe('nodemon fork', function () {
3030
// make nodemon verbose so we can check the filters being applied
3131
args: ['-q', '--exec', 'test/fixtures/app\\ with\\ spaces.js']
3232
}, {
33-
error: function (data) {
34-
p.send('quit');
35-
done(new Error(data));
36-
},
37-
output: function (data) {
38-
// process.stdout.write(data);
39-
if (data.trim() === 'OK') {
40-
found = true;
41-
}
42-
}
43-
});
44-
45-
p.on('message', function (event) {
46-
if (event.type === 'start') {
47-
setTimeout(function () {
33+
error: function (data) {
4834
p.send('quit');
49-
done();
50-
assert(found, '"OK" message was found');
51-
}, 500);
52-
}
53-
});
54-
});
55-
56-
it('should start a fork exec with quotes and escaping', function (done) {
57-
var found = false;
58-
var p = run({
59-
exec: 'bin/nodemon.js',
60-
// make nodemon verbose so we can check the filters being applied
61-
args: ['-q', '--exec', 'test/fixtures/some\\\"file']
62-
}, {
63-
error: function (data) {
64-
p.send('quit');
65-
done(new Error(data));
66-
},
67-
output: function (data) {
68-
// process.stdout.write(data);
69-
if (data.trim() === 'OK') {
70-
found = true;
35+
done(new Error(data));
36+
},
37+
output: function (data) {
38+
// process.stdout.write(data);
39+
if (data.trim() === 'OK') {
40+
found = true;
41+
}
7142
}
72-
}
73-
});
74-
75-
p.on('message', function (event) {
76-
if (event.type === 'start') {
77-
setTimeout(function () {
78-
p.send('quit');
79-
done();
80-
assert(found, '"OK" message was found');
81-
}, 500);
82-
}
83-
});
84-
});
85-
86-
it('should start a fork exec with spaces and slashes', function (done) {
87-
var found = false;
88-
var p = run({
89-
exec: 'bin/nodemon.js',
90-
// make nodemon verbose so we can check the filters being applied
91-
args: ['-q', '--exec', '"test/fixtures/some\ \\file"']
92-
}, {
93-
error: function (data) {
94-
p.send('quit');
95-
done(new Error(data));
96-
},
97-
output: function (data) {
98-
// process.stdout.write(data);
99-
if (data.trim() === 'OK') {
100-
found = true;
101-
}
102-
}
103-
});
43+
});
10444

10545
p.on('message', function (event) {
10646
if (event.type === 'start') {
@@ -120,16 +60,16 @@ describe('nodemon fork', function () {
12060
// make nodemon verbose so we can check the filters being applied
12161
args: ['-q', '--exec', '"test/fixtures/app with spaces.js" foo'],
12262
}, {
123-
error: function (data) {
124-
p.send('quit');
125-
done(new Error(data));
126-
},
127-
output: function (data) {
128-
if (data.trim() === 'foo') {
129-
found = true;
63+
error: function (data) {
64+
p.send('quit');
65+
done(new Error(data));
66+
},
67+
output: function (data) {
68+
if (data.trim() === 'foo') {
69+
found = true;
70+
}
13071
}
131-
}
132-
});
72+
});
13373

13474
p.on('message', function (event) {
13575
if (event.type === 'start') {
@@ -151,17 +91,17 @@ describe('nodemon fork', function () {
15191
// make nodemon verbose so we can check the filters being applied
15292
args: ['-q', '--exec', 'test/fixtures/app\\ with\\ spaces.js foo']
15393
}, {
154-
error: function (data) {
155-
p.send('quit');
156-
done(new Error(data));
157-
},
158-
output: function (data) {
159-
// process.stdout.write(data);
160-
if (data.trim() === 'foo') {
161-
found = true;
94+
error: function (data) {
95+
p.send('quit');
96+
done(new Error(data));
97+
},
98+
output: function (data) {
99+
// process.stdout.write(data);
100+
if (data.trim() === 'foo') {
101+
found = true;
102+
}
162103
}
163-
}
164-
});
104+
});
165105

166106
p.on('message', function (event) {
167107
if (event.type === 'start') {
@@ -173,4 +113,4 @@ describe('nodemon fork', function () {
173113
}
174114
});
175115
});
176-
});
116+
});

0 commit comments

Comments
 (0)