@@ -62,12 +62,8 @@ public HttpResponseMessage Invoke(string name, [FromBody] FunctionInvocation inv
62
62
[ Route ( "admin/functions/{name}/status" ) ]
63
63
public FunctionStatus GetFunctionStatus ( string name )
64
64
{
65
+ FunctionStatus status = new FunctionStatus ( ) ;
65
66
Collection < string > functionErrors = null ;
66
- FunctionDescriptor function = _scriptHostManager . Instance . Functions . FirstOrDefault ( p => p . Name . ToLowerInvariant ( ) == name . ToLowerInvariant ( ) ) ;
67
- FunctionStatus status = new FunctionStatus
68
- {
69
- Metadata = function ? . Metadata
70
- } ;
71
67
72
68
// first see if the function has any errors
73
69
if ( _scriptHostManager . Instance . FunctionErrors . TryGetValue ( name , out functionErrors ) )
@@ -78,6 +74,7 @@ public FunctionStatus GetFunctionStatus(string name)
78
74
{
79
75
// if we don't have any errors registered, make sure the function exists
80
76
// before returning empty errors
77
+ FunctionDescriptor function = _scriptHostManager . Instance . Functions . FirstOrDefault ( p => p . Name . ToLowerInvariant ( ) == name . ToLowerInvariant ( ) ) ;
81
78
if ( function == null )
82
79
{
83
80
throw new HttpResponseException ( HttpStatusCode . NotFound ) ;
@@ -93,10 +90,7 @@ public HostStatus GetHostStatus()
93
90
{
94
91
HostStatus status = new HostStatus
95
92
{
96
- Id = _scriptHostManager . Instance ? . ScriptConfig . HostConfig . HostId ,
97
- WebHostSettings = _webHostSettings ,
98
- ProcessId = Process . GetCurrentProcess ( ) . Id ,
99
- IsDebuggerAttached = Debugger . IsAttached
93
+ Id = _scriptHostManager . Instance ? . ScriptConfig . HostConfig . HostId
100
94
} ;
101
95
102
96
var lastError = _scriptHostManager . LastError ;
@@ -111,13 +105,21 @@ public HostStatus GetHostStatus()
111
105
112
106
[ HttpPost ]
113
107
[ Route ( "admin/host/debug" ) ]
114
- public bool LaunchDebugger ( )
108
+ public HttpResponseMessage LaunchDebugger ( )
115
109
{
116
110
if ( _webHostSettings . IsSelfHost )
117
111
{
118
- return Debugger . Launch ( ) ;
112
+ // If debugger is already running, this will be a no-op returning true.
113
+ if ( Debugger . Launch ( ) )
114
+ {
115
+ return new HttpResponseMessage ( HttpStatusCode . OK ) ;
116
+ }
117
+ else
118
+ {
119
+ return new HttpResponseMessage ( HttpStatusCode . Conflict ) ;
120
+ }
119
121
}
120
- return false ;
122
+ return new HttpResponseMessage ( HttpStatusCode . NotImplemented ) ;
121
123
}
122
124
123
125
public override Task < HttpResponseMessage > ExecuteAsync ( HttpControllerContext controllerContext , CancellationToken cancellationToken )
0 commit comments