Skip to content

Commit e9ab5c4

Browse files
committed
[GH-17] Supply mime type for input file, so we don't start reading to get it (in case it's a non-seekable stream)
PullRequest: graalpython/255
2 parents ec04dcc + d8b6727 commit e9ab5c4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

graalpython/com.oracle.graal.python.shell/src/com/oracle/graal/python/shell/GraalPythonMain.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public static void main(String[] args) {
5858
}
5959

6060
private static final String LANGUAGE_ID = "python";
61+
private static final String MIME_TYPE = "text/x-python";
6162

6263
private ArrayList<String> programArgs = null;
6364
private String commandString = null;
@@ -306,7 +307,7 @@ private void evalNonInteractive(Context context) throws IOException {
306307
src = Source.newBuilder(getLanguageId(), commandString, "<string>").build();
307308
} else {
308309
assert inputFile != null;
309-
src = Source.newBuilder(getLanguageId(), new File(inputFile)).build();
310+
src = Source.newBuilder(getLanguageId(), new File(inputFile)).mimeType(MIME_TYPE).build();
310311
}
311312
context.eval(src);
312313
}

0 commit comments

Comments
 (0)