Signed-off-by: ale <ale@manalejandro.com>
Este commit está contenido en:
ale
2025-10-08 03:52:18 +02:00
padre 56452988a9
commit 63dc85ddae
Se han modificado 2 ficheros con 20 adiciones y 16 borrados

Ver fichero

@@ -81,9 +81,16 @@ export class PythonBridge extends EventEmitter {
const output = data.toString();
this.logger.debug('Python stdout:', output);
if (!initialized && (output.includes('CUDA Quantum Python Bridge') || output.includes('Ready'))) {
initialized = true;
resolve();
// Check for initialization messages
if (!initialized) {
if (output.includes('CUDA Quantum Python Bridge') || output.includes('Ready')) {
initialized = true;
resolve();
} else if (output.includes('INFO - CUDA Quantum successfully imported')) {
this.logger.info('CUDA Quantum initialized successfully');
} else if (output.includes('WARNING - CUDA Quantum not available')) {
this.logger.warn('CUDA Quantum not available, running in mock mode');
}
}
// Handle JSON responses
@@ -93,17 +100,14 @@ export class PythonBridge extends EventEmitter {
this.pythonProcess.stderr?.on('data', (data: Buffer) => {
const error = data.toString();
// Check if it's just a warning about CUDA Quantum not being available
if (error.includes('WARNING') && error.includes('CUDA Quantum not available')) {
this.logger.warn('Python warning:', error);
// Don't treat this as a fatal error - continue with initialization
if (!initialized) {
initialized = true;
resolve();
}
} else {
// Log stderr messages but don't treat them as fatal errors during initialization
// Most Python logging goes to stderr even for non-errors
if (error.includes('WARNING') || error.includes('INFO') || error.includes('DEBUG')) {
this.logger.debug('Python log message:', error);
} else if (error.trim()) {
this.logger.error('Python stderr:', error);
if (!initialized) {
// Only reject during initialization if it's a real error (not a log message)
if (!initialized && !error.includes('INFO') && !error.includes('WARNING') && !error.includes('DEBUG')) {
reject(new Error(`Python process error: ${error}`));
}
}