mirror of https://github.com/winsw/winsw
ready to push 1.3
git-svn-id: https://svn.kenai.com/svn/winsw~subversion/trunk@6 c8b2a3fe-9b5b-6a51-a37e-dc31b0e308faremotes/git-svn
parent
0b36ee6a73
commit
cee2f0a19e
46
Main.cs
46
Main.cs
|
@ -177,8 +177,54 @@ namespace winsw
|
||||||
o.Close();
|
o.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Process the file copy instructions, so that we can replace files that are always in use while
|
||||||
|
/// the service runs.
|
||||||
|
/// </summary>
|
||||||
|
private void HandleFileCopies()
|
||||||
|
{
|
||||||
|
var file = descriptor.BasePath + ".copies";
|
||||||
|
if (!File.Exists(file))
|
||||||
|
return; // nothing to handle
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (var tr = new StreamReader(file,Encoding.UTF8))
|
||||||
|
{
|
||||||
|
string line;
|
||||||
|
while ((line = tr.ReadLine()) != null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
EventLog.WriteEntry("Handling copy: " + line);
|
||||||
|
string[] tokens = line.Split('>');
|
||||||
|
if (tokens.Length > 2)
|
||||||
|
{
|
||||||
|
EventLog.WriteEntry("Too many delimiters in " + line);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
File.Delete(tokens[1]);
|
||||||
|
File.Move(tokens[0], tokens[1]);
|
||||||
|
}
|
||||||
|
catch(IOException e)
|
||||||
|
{
|
||||||
|
EventLog.WriteEntry("Failed to copy :"+line+" because "+e.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
File.Delete(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnStart(string[] args)
|
protected override void OnStart(string[] args)
|
||||||
{
|
{
|
||||||
|
HandleFileCopies();
|
||||||
|
|
||||||
EventLog.WriteEntry("Starting "+descriptor.Executable+' '+descriptor.Arguments);
|
EventLog.WriteEntry("Starting "+descriptor.Executable+' '+descriptor.Arguments);
|
||||||
string baseName = descriptor.BasePath;
|
string baseName = descriptor.BasePath;
|
||||||
|
|
||||||
|
|
4
pom.xml
4
pom.xml
|
@ -5,7 +5,7 @@
|
||||||
<groupId>com.sun.winsw</groupId>
|
<groupId>com.sun.winsw</groupId>
|
||||||
<artifactId>winsw</artifactId>
|
<artifactId>winsw</artifactId>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<version>1.2</version>
|
<version>1.3</version>
|
||||||
<name>Windows service wrapper</name>
|
<name>Windows service wrapper</name>
|
||||||
|
|
||||||
<distributionManagement>
|
<distributionManagement>
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
<extension>
|
<extension>
|
||||||
<groupId>org.jvnet.wagon-svn</groupId>
|
<groupId>org.jvnet.wagon-svn</groupId>
|
||||||
<artifactId>wagon-svn</artifactId>
|
<artifactId>wagon-svn</artifactId>
|
||||||
<version>1.8</version>
|
<version>1.9</version>
|
||||||
</extension>
|
</extension>
|
||||||
</extensions>
|
</extensions>
|
||||||
</build>
|
</build>
|
||||||
|
|
Loading…
Reference in New Issue