Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions bdist/js/bin/protoc-gen-protolint.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import { spawn } from 'node:child_process';
import path from 'node:path';
import process from 'node:process';
import { fileURLToPath } from 'node:url';

const __dirname = path.dirname(fileURLToPath(import.meta.url));
Expand All @@ -10,16 +11,23 @@ const extension = process.platform === 'win32' ? '.exe' : '';

const command = path.resolve(__dirname, 'protoc-gen-protolint' + extension);

const protoc = spawn(command, process.argv.slice(2), {
stdio: 'inherit', // This inherits stdin, stdout, and stderr
windowsHide: true,
});
/** @type {Promise<void>} */
const promise = new Promise((resolve) => {
const protoc = spawn(command, process.argv.slice(2), {
stdio: 'inherit', // This inherits stdin, stdout, and stderr
windowsHide: true,
});

protoc.on('close', (code) => {
process.exitCode = code ?? 0;
});
protoc.on('close', (code) => {
process.exitCode = code ?? 0;
resolve();
});

protoc.on('error', (error) => {
console.error(`Failed to start protoc-gen-protolint: ${error.message}`);
process.exitCode = 1;
protoc.on('error', (error) => {
console.error(`Failed to start protoc-gen-protolint: ${error.message}`);
process.exitCode = 1;
resolve();
});
});

await promise;
28 changes: 18 additions & 10 deletions bdist/js/bin/protolint.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import { spawn } from 'node:child_process';
import path from 'node:path';
import process from 'node:process';
import { fileURLToPath } from 'node:url';

const __dirname = path.dirname(fileURLToPath(import.meta.url));
Expand All @@ -10,16 +11,23 @@ const extension = process.platform === 'win32' ? '.exe' : '';

const command = path.resolve(__dirname, 'protolint' + extension);

const protolint = spawn(command, process.argv.slice(2), {
stdio: 'inherit', // This inherits stdin, stdout, and stderr
windowsHide: true,
});
/** @type {Promise<void>} */
const promise = new Promise((resolve) => {
const protolint = spawn(command, process.argv.slice(2), {
stdio: 'inherit',
windowsHide: true,
});

protolint.on('close', (code) => {
process.exitCode = code ?? 0;
});
protolint.on('close', (code) => {
process.exitCode = code ?? 0;
resolve();
});

protolint.on('error', (error) => {
console.error(`Failed to start protolint: ${error.message}`);
process.exitCode = 1;
protolint.on('error', (error) => {
console.error(`Failed to start protolint: ${error.message}`);
process.exitCode = 1;
resolve();
});
});

await promise;
Loading