-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-debug-buffer.js
More file actions
51 lines (42 loc) · 1.37 KB
/
Copy pathtest-debug-buffer.js
File metadata and controls
51 lines (42 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
const path = require('path');
const fs = require('fs');
// Importar o módulo file-unlocker
const fileUnlocker = require('./lib/file-unlocker');
// Teste de debug do buffer
async function testDebugBuffer() {
console.log('=== Teste de Debug do Buffer ===');
// Criar um arquivo de teste
const testContent = 'Teste de arquivo para debug';
fs.writeFileSync('test-debug.txt', testContent);
console.log('Arquivo de teste criado: test-debug.txt');
try {
// Forçar execução da função getProcessesWithWindowsAPI
console.log('Testando getProcessesWithWindowsAPI...');
const processes = await fileUnlocker.getProcessesWithWindowsAPI('test-debug.txt');
console.log('Processos encontrados:', processes);
} catch (error) {
console.error('Erro ao testar getProcessesWithWindowsAPI:', error);
}
// Limpar arquivo de teste
try {
fs.unlinkSync('test-debug.txt');
console.log('Arquivo de teste removido');
} catch (error) {
console.log('Erro ao remover arquivo:', error.message);
}
console.log('=== Fim do Teste de Debug ===');
}
// Executar teste diretamente
async function main() {
try {
await testDebugBuffer();
console.log('Teste concluído com sucesso');
} catch (error) {
console.error('Erro no teste:', error);
process.exit(1);
}
}
// Executar se for o arquivo principal
if (require.main === module) {
main();
}