0.1.2 • Published 7 months ago

wine-child-process v0.1.2

Weekly downloads
-
License
ISC
Repository
github
Last release
7 months ago

Wine Child Process

A child process implementation that automatically utilizes wine when running Windows EXE applications in Linux and macOS.

This modules aims to be a simple bridge between the common child process functions and Wine as required.

Child Process Functions

Basic child process functions are provided that runs Wine automicatilly when running in Linux or macOS. Otherwise, these functions acts similarly to the child process counterpart.

exec

Calls exec function from child_process module. Wine is automatically used when using Linux or macOS.

Returns the child_process.ChildProcess if successful or null if using Linux or macOS with no Wine installed

For more information, please refer to child_process.exec documentation.

ParameterTypeDescription
commandstringThe command to run, with space-separated arguments
optionschild_process.ExecOptionsAdditional options for the exec function
callbackcallback(err, stdout, stderr)Called with the output when process terminates

execFile

Calls execFile function from child_process module. Wine is automatically used when using Linux or macOS.

Returns the child_process.ChildProcess if successful or null if using Linux or macOS with no Wine installed

For more information, please refer to child_process.execFile documentation.

ParameterTypeDescription
filestringThe name or path of the executable file to run
argsreadonly string[]List of string arguments
optionschild_process.ExecFileOptionsAdditional options for the execFile function
callbackcallback(err, stdout, stderr)Called with the output when process terminates

execSync

Calls execSync function from child_process module. Wine is automatically used when using Linux or macOS.

Returns the output Buffer or string if successful or null if using Linux or macOS with no Wine installed

For more information, please refer to child_process.execSync documentation.

ParameterTypeDescription
commandstringThe command to run, with space-separated arguments
optionschild_process.ExecSyncOptionsAdditional options for the exec function

execFileSync

Calls execFileSync function from child_process module. Wine is automatically used when using Linux or macOS.

Returns the output Buffer or string if successful or null if using Linux or macOS with no Wine installed

For more information, please refer to child_process.execFileSync documentation.

ParameterTypeDescription
filestringThe name or path of the executable file to run
argsreadonly string[]List of string arguments
optionschild_process.ExecFileSyncOptionsAdditional options for the execFile function

Utility Functions

Some utility functions are also provided for basic check such as checking if Wine is installed in the system.

checkWindowsOrWine

Returns true if the system is running Windows or if Wine is installed in Linux or macOS. Otherwise, returns false.

This is useful when checking if the rest of the child process functions can be safely used without running the child process functions.

Usage Notes

It is advisable to check whether the functions can used to create child processes.

if (checkWindowsOrWine()) {
    // Perform child process functions
}

When using cwd option, the path is automatically joined with the exe command/file. This is only performed when running Linux and macOS since the main command becomes wine