33 * SPDX-License-Identifier: Apache-2.0
44 */
55import assert from 'assert'
6- import { envWithNewPath , readEnv , setEnv } from '../../testUtil'
6+ import { createExecutableFile , createTestWorkspaceFolder , envWithNewPath , readEnv , setEnv } from '../../testUtil'
7+ import path from 'path'
8+ import { ChildProcess } from '../../../shared/utilities/processUtils'
9+ import { fs } from '../../../shared'
710
811describe ( 'envWithNewPath' , function ( ) {
912 it ( 'gives current path with new PATH' , function ( ) {
@@ -23,3 +26,18 @@ describe('writeEnv', function () {
2326 assert . deepStrictEqual ( readEnv ( ) , originalEnv )
2427 } )
2528} )
29+
30+ describe ( 'createExecutableFile' , function ( ) {
31+ it ( 'creates a file that can be executes in a child process' , async function ( ) {
32+ const tempDir = await createTestWorkspaceFolder ( )
33+ const filePath = path . join ( tempDir . uri . fsPath , 'exec' )
34+ await createExecutableFile ( filePath , '' )
35+
36+ const proc = new ChildProcess ( filePath )
37+ const result = await proc . run ( )
38+ assert . ok ( result )
39+ assert . ok ( result . exitCode === 0 )
40+
41+ await fs . delete ( tempDir . uri , { force : true , recursive : true } )
42+ } )
43+ } )
0 commit comments