浏览代码

FileServer.st: add -p commandline option

node server/server.js -p 5000

will start the server to listen on port 5000
mkroehnert 12 年之前
父节点
当前提交
9b4ca5d461
共有 1 个文件被更改,包括 8 次插入0 次删除
  1. 8 0
      server/FileServer.st

+ 8 - 0
server/FileServer.st

@@ -573,6 +573,14 @@ mimeTypeFor: aString
 !FileServer class methodsFor: 'initialization'!
 
 main
+	| arguments portOption port|
+	arguments := process argv.
+	portOption := arguments at: 3 ifAbsent: [nil].
+	port := arguments at: 4 ifAbsent: [nil].
+
+	('-p' = portOption and: [port notNil]) ifTrue: [
+		FileServer port: port.
+	].
 	^self new startOn: self port
 ! !