This repository has been archived by the owner on Jan 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add 'snapshot' entry to readdir('/') results
- Loading branch information
1 parent
70c4f28
commit e29c883
Showing
3 changed files
with
84 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env node | ||
|
||
'use strict'; | ||
|
||
const path = require('path'); | ||
const assert = require('assert'); | ||
const utils = require('../utils.js'); | ||
|
||
assert(!module.parent); | ||
assert(__dirname === process.cwd()); | ||
|
||
const target = process.argv[2] || 'host'; | ||
const input = './test-x-index.js'; | ||
const output = './test-output.exe'; | ||
|
||
let right; | ||
|
||
utils.pkg.sync([ | ||
'--target', target, | ||
'--output', output, input | ||
]); | ||
|
||
right = utils.spawn.sync( | ||
'./' + path.basename(output), [], | ||
{ cwd: path.dirname(output) } | ||
); | ||
|
||
assert.equal(right, 'ok\n'); | ||
utils.vacuum.sync(output); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env node | ||
|
||
'use strict'; | ||
|
||
var fs = require('fs'); | ||
var path = require('path'); | ||
|
||
if (process.platform === 'win32') { | ||
var root = path.parse(process.argv[1]).root; // D:\\ | ||
if (fs.readdirSync(root).indexOf('snapshot') >= 0) { | ||
fs.readdir(root, function (error, entries) { | ||
if (error) throw error; | ||
if (entries.indexOf('snapshot')) { | ||
console.log('ok'); | ||
} | ||
}); | ||
} | ||
} else { | ||
if (fs.readdirSync('/').indexOf('snapshot') >= 0) { | ||
fs.readdir('/', function (error, entries) { | ||
if (error) throw error; | ||
if (entries.indexOf('snapshot')) { | ||
console.log('ok'); | ||
} | ||
}); | ||
} | ||
} |