cross-spawn-windows-exe
Cross-platform support for running Windows executables
Last updated 3 years ago by malept .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install cross-spawn-windows-exe 
SYNC missed versions from official npm registry.

cross-spawn-windows-exe

Cross-platform support for running Windows executables via Node.js.

CI codecov

Utilizes @malept/cross-spawn-promise (and by extension, cross-spawn) to execute Windows executables regardless of platform.

For all platforms, Node 10 or above is required.

On non-Windows, non-WSL host systems, the following dependencies are required:

  • .NET executables: Mono
  • All other Windows executables: Wine

Usage

Using the cross-spawn-windows-exe API is similar in terms of function signature to spawn in @malept/cross-spawn-promise.

Running a .NET executable

// Note: top-level await exists in Node >= 14.8.0. In earlier versions of Node, please wrap in an
// async function.

const { spawnDotNet } = require("cross-spawn-windows-exe");

await spawnDotNet("./hellodotnet.exe", ["--arg1"]);

Running a Windows executable

// Note: top-level await exists in Node >= 14.8.0. In earlier versions of Node, please wrap in an
// async function.

const { spawnExe } = require("cross-spawn-windows-exe");

await spawnExe("./hellowindows.exe", ["--arg1"]);

Normalizing Paths

Executables generally can't handle UNIX-style paths that Windows Subsystem for Linux (WSL) passes in, since it's a Linux environment. This module provides a function to convert those paths from UNIX-style to Windows-style (via wslpath, which should be installed by default on every WSL distribution), if the host system is determined to be WSL. For non-WSL environments, this is a no-op.

// Note: top-level await exists in Node >= 14.8.0. In earlier versions of Node, please wrap in an
// async function.

const { normalizePath, spawnExe } = require("cross-spawn-windows-exe");

const normalizedPath = await normalizePath("/tmp/foo");
await spawnExe("./openfile.exe", ["--filename", normalizedPath]);

Legal

This module is licensed under the Apache License, version 2.0. See LICENSE for details.

Current Tags

  • 1.2.0                                ...           latest (3 years ago)

4 Versions

  • 1.2.0                                ...           3 years ago
  • 1.1.0                                ...           3 years ago
  • 1.0.0                                ...           4 years ago
  • 0.1.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (3)
Dev Dependencies (24)
Dependents (2)

Copyright 2013 - present © cnpmjs.org | Home |