修改bug

master
whb 8 months ago
parent dd3fc36a19
commit be96e3693d

@ -89,50 +89,6 @@ public class JupyterhubController {
//创建文件夹
dataFile.mkdir();
//修改权限
try {
// 创建 chmod 命令以递归方式修改权限
String[] command = {"chmod", "-R", "777", newCreatFile};
// 创建一个新的进程来执行Python代码
Process process = Runtime.getRuntime().exec(command);
// 获取进程的输入流
BufferedReader inputStream = new BufferedReader(new InputStreamReader(process.getInputStream()));
// 获取进程的输出流
BufferedReader errorStream = new BufferedReader(new InputStreamReader(process.getErrorStream()));
// 读取Python代码的输出
String line;
StringBuilder output = new StringBuilder();
while ((line = inputStream.readLine()) != null) {
output.append(line).append("\n");
}
// 读取Python代码的错误信息
StringBuilder errors = new StringBuilder();
while ((line = errorStream.readLine()) != null) {
errors.append(line).append("\n");
}
// 等待进程执行完成
int exitCode = process.waitFor();
if (exitCode == 0) {
// 执行成功输出Python代码的结果
System.out.println("权限修改成功!");
} else {
// 执行失败,输出错误信息
System.err.println("权限修改失败了!\n" + errors.toString());
}
} catch (IOException | InterruptedException e) {
e.printStackTrace();
}
//判断有无ipynb文件进行迁移
// 使用File类表示这个文件
@ -198,7 +154,6 @@ public class JupyterhubController {
} else {
//判断子目录是否有data文件
String sonPath = newCreatFile + "/data";
File sonFile = new File(sonPath);
if (sonFile.exists()) {

Loading…
Cancel
Save