Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F4410241
test_child_process_execfile_git_options.cjs
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
test_child_process_execfile_git_options.cjs
View Options
const { promisify } = require('node:util');
const { execFile } = require('node:child_process');
const path = require('node:path');
async function main() {
const execFileAsync = promisify(execFile);
const cwd = path.join(__dirname, '..');
const revParse = await execFileAsync(
'git',
['rev-parse', '--show-toplevel'],
{ cwd, encoding: 'utf8', maxBuffer: 16 * 1024 * 1024 }
);
if (!revParse || typeof revParse.stdout !== 'string') {
throw new Error('expected rev-parse stdout string');
}
if (!revParse.stdout.trim().endsWith('/ant')) {
throw new Error(`unexpected rev-parse output: ${JSON.stringify(revParse.stdout)}`);
}
const status = await execFileAsync(
'git',
['status', '--porcelain=v1', '-z', '--untracked-files=normal'],
{ cwd, encoding: 'utf8', maxBuffer: 16 * 1024 * 1024 }
);
if (!status || typeof status.stdout !== 'string') {
throw new Error('expected status stdout string');
}
console.log('util.promisify(execFile) handles git with options');
}
main().catch((err) => {
console.error(err && err.stack ? err.stack : String(err));
process.exit(1);
});
File Metadata
Details
Attached
Mime Type
application/javascript
Expires
Fri, May 1, 7:32 PM (1 d, 23 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
542973
Default Alt Text
test_child_process_execfile_git_options.cjs (1 KB)
Attached To
Mode
rANT Ant
Attached
Detach File
Event Timeline
Log In to Comment